package com.ruoyi.system.service.impl;

import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.JiajiaMallProductType;
import com.ruoyi.system.mapper.JiajiaMallProductTypeMapper;
import com.ruoyi.system.service.IJiajiaMallProductTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 商城产品大类Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-05
 */
@Service
public class JiajiaMallProductTypeServiceImpl implements IJiajiaMallProductTypeService 
{
    @Autowired
    private JiajiaMallProductTypeMapper jiajiaMallProductTypeMapper;

    /**
     * 查询商城产品大类
     * 
     * @param id 商城产品大类主键
     * @return 商城产品大类
     */
    @Override
    public JiajiaMallProductType selectJiajiaMallProductTypeById(Long id)
    {
        return jiajiaMallProductTypeMapper.selectJiajiaMallProductTypeById(id);
    }

    /**
     * 查询商城产品大类列表
     * 
     * @param jiajiaMallProductType 商城产品大类
     * @return 商城产品大类
     */
    @Override
    public List<JiajiaMallProductType> selectJiajiaMallProductTypeList(JiajiaMallProductType jiajiaMallProductType)
    {
        return jiajiaMallProductTypeMapper.selectJiajiaMallProductTypeList(jiajiaMallProductType);
    }

    /**
     * 新增商城产品大类
     * 
     * @param jiajiaMallProductType 商城产品大类
     * @return 结果
     */
    @Override
    public int insertJiajiaMallProductType(JiajiaMallProductType jiajiaMallProductType)
    {
        jiajiaMallProductType.setCreateTime(DateUtils.getNowDate());
        return jiajiaMallProductTypeMapper.insertJiajiaMallProductType(jiajiaMallProductType);
    }

    /**
     * 修改商城产品大类
     * 
     * @param jiajiaMallProductType 商城产品大类
     * @return 结果
     */
    @Override
    public int updateJiajiaMallProductType(JiajiaMallProductType jiajiaMallProductType)
    {
        jiajiaMallProductType.setUpdateTime(DateUtils.getNowDate());
        return jiajiaMallProductTypeMapper.updateJiajiaMallProductType(jiajiaMallProductType);
    }

    /**
     * 批量删除商城产品大类
     * 
     * @param ids 需要删除的商城产品大类主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaMallProductTypeByIds(String ids)
    {
        return jiajiaMallProductTypeMapper.deleteJiajiaMallProductTypeByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除商城产品大类信息
     * 
     * @param id 商城产品大类主键
     * @return 结果
     */
    @Override
    public int deleteJiajiaMallProductTypeById(Long id)
    {
        return jiajiaMallProductTypeMapper.deleteJiajiaMallProductTypeById(id);
    }
}
